<!--面包屑组件-->
<template>
  <a-breadcrumb style="margin: 10px 0">
    <a-breadcrumb-item v-for="item in routeList" :key="item.path" @click="go(item.path)">{{
      item.meta.name
    }}</a-breadcrumb-item>
  </a-breadcrumb>
</template>

<script lang="ts" setup>
import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
let routeList = ref<Array<any>>([])
onMounted(() => {
  routeList.value = router.currentRoute.value.matched.flat()
})

function go(path: string) {
  if (path == '/home') return
  router.push(path)
}
</script>

<style scoped lang="scss">
:deep(.ant-breadcrumb-link) {
  cursor: pointer;
}
</style>
